package com.nondo.dean.dealer.controller.api.app;

import com.nondo.dean.common.web.View;
import com.nondo.dean.dealer.model.result.CustomerResult;
import com.nondo.dean.dealer.service.CustomerViewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author xiaofan
 * @Description:
 * @throws
 * @date 2018-05-1814:50
 * @Version
 */
@RestController("apiAppDealerCustomerView")
@RequestMapping("/{v}/app/customer/view")
public class CustomerViewController {

    @Autowired
    CustomerViewService customerViewService;

    @RequestMapping("/select/{id}")
    public View<CustomerResult>  searchCustomer(@PathVariable("id") int id){
        View<CustomerResult> view = new View<>(20000,"查询成功");
        CustomerResult result = customerViewService.searchCustomer(id);
        if(result == null){
            result = new CustomerResult();
        }
        view.setData(result);
        return view;
    }

}
